package Lab12Package;
//Java String 

public class Lab12_04 {
	public static void main(String[] args) {
		// 字符串长度
		System.out.println();
		String site = "www.ppppp.cn";
		int len = site.length();
		System.out.println("网址长度 : " + len);

		// 连接字符串
		System.out.println();
		String str1 = "string1";
		String str2 = "string2";
		String str3;
		str3 = str1.concat(" ").concat(str2);
		System.out.println(str3);
		str3 = str1 + " " + str2;
		System.out.println(str3);

		// 格式化字符串
		System.out.println();
		float floatVar = (float) 2.008;
		int intVar = 96;
		String stringVar = "My String";
		System.out.printf(
				"浮点型变量的值为 " + "%f, 整型变量的值为 " + " %d, 字符串变量的值为 " + "is %s\n",
				floatVar, intVar, stringVar);
		String fs;
		fs = String.format(
				"浮点型变量的值为 " + "%f, 整型变量的值为 " + " %d, 字符串变量的值为 " + " %s",
				floatVar, intVar, stringVar);
		System.out.printf(fs);

	}

}
